import 'package:flutter/material.dart';

import '../../constant/colors.dart';


class AppTheme {
  /// 浅色主题
  static ThemeData get lightTheme {
    return ThemeData(
      brightness: Brightness.light,
      primarySwatch: Colors.blue,
      primaryColor: AppColor.primary,
      scaffoldBackgroundColor: AppColor.scaffoldBackground,

      appBarTheme: AppBarTheme(backgroundColor: AppColor.white, foregroundColor: AppColor.textPrimary, elevation: 0, centerTitle: true),

      cardTheme: CardTheme(color: AppColor.cardBackground, elevation: 2, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8))),

      textTheme: TextTheme(
        bodyLarge: TextStyle(color: AppColor.textPrimary),
        bodyMedium: TextStyle(color: AppColor.textSecondary),
        titleLarge: TextStyle(color: AppColor.textPrimary, fontWeight: FontWeight.bold),
        titleMedium: TextStyle(color: AppColor.textPrimary, fontWeight: FontWeight.w500),
      ),

      colorScheme: ColorScheme.light(
        primary: AppColor.primary,
        secondary: AppColor.secondary,
        surface: AppColor.cardBackground,
        background: AppColor.scaffoldBackground,
        onPrimary: AppColor.white,
        onSecondary: AppColor.white,
        onSurface: AppColor.textPrimary,
        onBackground: AppColor.textPrimary,
      ),

      elevatedButtonTheme: ElevatedButtonThemeData(
        style: ElevatedButton.styleFrom(
          backgroundColor: AppColor.buttonPrimary,
          foregroundColor: AppColor.buttonText,
          elevation: 2,
          shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
        ),
      ),

      outlinedButtonTheme: OutlinedButtonThemeData(
        style: OutlinedButton.styleFrom(
          foregroundColor: AppColor.primary,
          side: BorderSide(color: AppColor.border),
          shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
        ),
      ),
    );
  }

  /// 深色主题
  static ThemeData get darkTheme {
    return ThemeData(
      brightness: Brightness.dark,
      primarySwatch: Colors.blue,
      primaryColor: AppColor.primary,
      scaffoldBackgroundColor: AppColor.black,

      appBarTheme: AppBarTheme(backgroundColor: AppColor.black, foregroundColor: AppColor.white, elevation: 0, centerTitle: true),

      cardTheme: CardTheme(color: AppColor.darkGrey, elevation: 2, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8))),

      textTheme: TextTheme(
        bodyLarge: TextStyle(color: AppColor.white),
        bodyMedium: TextStyle(color: AppColor.textSecondary),
        titleLarge: TextStyle(color: AppColor.white, fontWeight: FontWeight.bold),
        titleMedium: TextStyle(color: AppColor.white, fontWeight: FontWeight.w500),
      ),

      colorScheme: ColorScheme.dark(
        primary: AppColor.primary,
        secondary: AppColor.secondary,
        surface: AppColor.darkGrey,
        background: AppColor.black,
        onPrimary: AppColor.white,
        onSecondary: AppColor.white,
        onSurface: AppColor.white,
        onBackground: AppColor.white,
      ),

      elevatedButtonTheme: ElevatedButtonThemeData(
        style: ElevatedButton.styleFrom(
          backgroundColor: AppColor.buttonPrimary,
          foregroundColor: AppColor.buttonText,
          elevation: 2,
          shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
        ),
      ),

      outlinedButtonTheme: OutlinedButtonThemeData(
        style: OutlinedButton.styleFrom(
          foregroundColor: AppColor.primary,
          side: BorderSide(color: AppColor.border),
          shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
        ),
      ),
    );
  }
}
